import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import ECharts from 'vue-echarts'

const app = createApp(App)
app.use(ElementPlus)

// 全局注册ECharts组件
app.component('v-chart', ECharts)

// 顺序不能变：先Pinia后Router
const pinia = createPinia()
app.use(pinia)
app.use(router)

// 全局错误处理
app.config.errorHandler = (err) => {
  console.error('[全局错误]', err)
}

app.mount('#app')
